﻿@using System.Globalization
@model CustomerMerchandiseReturnsModel
@inject IPageHeadBuilder pagebuilder
@{
    Layout = "_TwoColumns";

    //title
    pagebuilder.AddTitleParts(Loc["Title.Account"]);
}

@section left
{
    @await Component.InvokeAsync("CustomerNavigation", new { selectedTabId = AccountNavigationEnum.MerchandiseReturns })
}

<div class="page account-page return-request-list-page pl-lg-3 pt-3 pt-lg-0">
    <h1 class="h2 generalTitle">
        <div>@Loc["Account.CustomerMerchandiseReturns"]</div>
    </h1>
    <a class="left-side-toggler mb-3" onclick="sideToggle()">
        <div class="inner">
            <span></span>
            <span></span>
            <span></span>
        </div>
        <div class="text">
            @Loc["Account.Navigation"]
        </div>
    </a>
    @if (Model.Items.Any())
    {
        <b-row>
            @foreach (var item in Model.Items)
            {
                <b-col class="col-lg-6 col-md-6 col-12">
                    <b-card>
                        <template v-slot:header>
                            <h5 class="mb-0">
                                @string.Format(Loc["Account.CustomerMerchandiseReturns.Title"], item.ReturnNumber, item.MerchandiseReturnStatus)
                            </h5>
                        </template>
                        <div class="d-inline-flex align-items-center flex-wrap mb-3">
                            <b-icon icon="calendar2-check" variant="info" class="mx-2"></b-icon>
                            <small class="date text-muted">
                                <label class="mb-0">@Loc["Account.CustomerMerchandiseReturns.Date"]</label>
                                <span>@item.CreatedOn.ToString(CultureInfo.InvariantCulture)</span>
                            </small>
                        </div>
                        <div class="alert alert-info mb-0">
                            @string.Format(Loc["Account.CustomerMerchandiseReturns.Totals"], item.ProductsCount, item.ReturnTotal)
                        </div>
                        <template v-slot:footer>
                            <b-button variant="info" size="sm" onclick="location = ('@Url.RouteUrl("MerchandiseReturnDetails", new { merchandiseReturnId = item.Id })')">
                                @Loc["Account.CustomerMerchandiseReturns.Details"]
                            </b-button>
                        </template>
                    </b-card>
                </b-col>
            }
        </b-row>
    }
    else
    {
        <div class="no-data alert alert-info my-3">
            @Loc["Account.CustomerMerchandiseReturns.NoMerchandiseReturns"]
        </div>
    }
</div>